<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta
      http-equiv="X-UA-Compatible"
      content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1.0" />
    <title>css自定义属性</title>
    <meta
      name="keywords"
      content="demo,js,css,animate,技术方" />
    <style>
      body {
        background: #eee;
        margin: 0;
        padding: 8px;
      }
      .outbox {
        width: 400px;
        max-width: 90vw;
        margin: 0 auto;
      }
      .container {
        width: 100%;
        padding-bottom: 100%;
        position: relative;
      }
      @property --direct {
        syntax: '<angle>';
        initial-value: 0deg;
        inherits: false;
      }
      .card {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        --border-width: 1rem;
        border-radius: 0.25rem;
        padding: var(--border-width);
        --direct: 0deg;
        background: linear-gradient(var(--direct), rgba(112, 207, 40, 1) 0%, rgba(136, 222, 227, 1) 48%, rgba(0, 212, 255, 1) 100%);
        clip-path: polygon(
          0% 0%,
          0% 100%,
          var(--border-width) 100%,
          var(--border-width) var(--border-width),
          calc(100% - var(--border-width)) var(--border-width),
          calc(100% - var(--border-width)) calc(100% - var(--border-width)),
          var(--border-width) calc(100% - var(--border-width)),
          var(--border-width) 100%,
          100% 100%,
          100% 0%
        );
        animation: rotate 2s linear infinite;
      }
      @keyframes rotate {
        to {
          --direct: 360deg;
        }
      }
    </style>
  </head>

  <body>
    <div class="outbox">
      <div class="container">
        <div class="card"></div>
      </div>
    </div>
  </body>
</html>
